import axios from '@/util'; 

import type {
  MenuEntity,
  MenuPermEntity,
} from './typings';



/**
 * 得到所有菜单 GET /api/menu/all
 */
export async function get_api_menu_all (
  params: {
    /**  */
    hasBtn: any;
  },
  options?: Record<string, any>,
): Promise<MenuEntity> {
  return axios({
    method: 'GET',
    url: `/api/menu/all`,
    params: {
      ...params,
    },
    ...(options || {}),
  })
}

/**
 * 查询单个菜单下的所有按钮 GET /api/menu/one/{parentId}/btns
 */
export async function get_api_menu_one__parentid__btns (
  pathVars: {
    /**  */
    parentId: any;
  },
  options?: Record<string, any>,
): Promise<MenuEntity> {
  return axios({
    method: 'GET',
    url: `/api/menu/one/${pathVars.parentId}/btns`,
    ...(options || {}),
  })
}

/**
 * 查询单个菜单权限 GET /api/menu/one/{id}/menu-perm
 */
export async function get_api_menu_one__id__menu_perm (
  pathVars: {
    /**  */
    id: any;
  },
  options?: Record<string, any>,
): Promise<MenuPermEntity> {
  return axios({
    method: 'GET',
    url: `/api/menu/one/${pathVars.id}/menu-perm`,
    ...(options || {}),
  })
}

/**
 * 创建菜单 POST /api/menu
 */
export async function post_api_menu (
  data: {
    /** 父级菜单 */
    parentId?: string;
    /** 菜单名称 */
    name?: string;
    /** 菜单唯一标识，前端控制页面显隐 */
    code?: string;
    /** 菜单类型 1-菜单/目录 2-tabs 3-按钮 */
    type?: number;
    /** 排序 */
    orderNum?: number;
    /** 菜单接口路径权限 */
    menuPermList?: string__;
  },
  options?: Record<string, any>,
): Promise<any> {
  return axios({
    method: 'POST',
    url: `/api/menu`,
    data: {
      ...data,
    },
    ...(options || {}),
  })
}

/**
 * 更新菜单 PUT /api/menu
 */
export async function put_api_menu (
  data: {
    /** 菜单id */
    id?: string;
    /** 父级菜单 */
    parentId?: number;
    /** 菜单名称 */
    name?: string;
    /** 菜单唯一标识，前端控制页面显隐 */
    code?: string;
    /** 菜单类型 1-菜单/目录 2-tabs 3-按钮 */
    type?: number;
    /** 排序 */
    orderNum?: number;
    /** 菜单接口权限 */
    menuPermList?: string__;
  },
  options?: Record<string, any>,
): Promise<any> {
  return axios({
    method: 'PUT',
    url: `/api/menu`,
    data: {
      ...data,
    },
    ...(options || {}),
  })
}

/**
 * 删除菜单 DELETE /api/menu/{id}
 */
export async function delete_api_menu__id_ (
  pathVars: {
    /**  */
    id: any;
  },
  options?: Record<string, any>,
): Promise<any> {
  return axios({
    method: 'DELETE',
    url: `/api/menu/${pathVars.id}`,
    ...(options || {}),
  })
}
